#include "37namespace.hpp"
#include <string>
#include <iostream>

namespace pers
{
    using std::cin;
    using std::cout;
    using std::endl;

    void getPerson(Person &person)
    {
        cout << "Enter first name:";
        cin >> person.fname;
        cout << "Enter last name:";
        cin >> person.lname;
    }

    void showPerson(const Person &person)
    {
        cout << person.fname << "," << person.lname << endl;
    }
} // namespace pers


namespace debts{
    void getDebt(Debt &rd){
        getPerson(rd.name);
        std::cout << "Enter debt:" ;
        std::cin >> rd.amount;
    }
    void showDebt(Debt &rp){
        showPerson(rp.name);
        std::cout <<"$" << rp.amount << std::endl;
    }
    double sumDebt(const Debt ar[], int n){
        double total= 0;
        for (int i = 0; i < n; i++)
        {
            total += ar[i].amount;
        }
        return total;
    }
}

